<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
    <style type="text/css">
        body, html{width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
        #allmap{height:500px;width:100%;}
        #r-result{width:100%; font-size:14px;}
    </style>
    <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=6imZIu4HZeahx9NEAjSNumZXK7dI7XE7"></script>
    <title>城市名定位</title>
</head>
<body>
<div id="allmap"></div>

</body>
</html>
<script type="text/javascript">

    var markerArr = <?php echo $data ?>;
    // 百度地图API功能
    var map = new BMap.Map("allmap");
    map.centerAndZoom(new BMap.Point(113.264530,23.157000),11);
    map.enableScrollWheelZoom(true);

    var point = new Array(); //存放标注点经纬信息的数组
    var marker = new Array(); //存放标注点对象的数组

    for (var i = 0; i < markerArr.length; i++) {

        point[i] = new BMap.Point(markerArr[i].lnt, markerArr[i].lat); //循环生成新的地图点
        marker[i] = new BMap.Marker(point[i]); //按照地图点坐标生成标记
        map.addOverlay(marker[i]);
        marker[i].setAnimation(BMAP_ANIMATION_BOUNCE); //跳动的动画
        var label = new BMap.Label(markerArr[i].name, { offset: new window.BMap.Size(20, -10) });
        marker[i].setLabel(label);
    }



</script>